#include "player.h"
#include <stdio.h>
#include <tchar.h>
#include "player_impl.h"

TCHAR buffer[1024];

Player::Player()
{
    impl_ = new Player_impl();

}
Player::~Player()
{
   delete impl_;
}
bool Player::Play(TCHAR* fileName)
{
    return impl_->Play(fileName);
}
bool Player::Repeate()
{
    return impl_->Repeate();
}
PlayerState Player:: GetState()
{
    return impl_->GetState();
}
void Player::SetState(PlayerState ps)
{
    return impl_->SetState(ps);
}

void Player::Init(HWND wnd, HINSTANCE hInst)
{
    impl_->Init(wnd, hInst);
}
bool Player::Stop()
{
    return impl_->Stop();

}
bool Player::Pause()
{
    return impl_->Pause();

}
bool Player::PlayFrom(long pos)
{
    return impl_->PlayFrom(pos);
}
/*
void Hotkey(PlayerState& ps, long lParam){
    if(HIWORD(lParam) == VK_F3){
        startPos = MCIWndGetPosition(playerWnd);
        _stprintf(buffer, TEXT("StartPos = %d \n"), startPos);
        OutputDebugString(buffer);
        state_ = play;
    }
    if(HIWORD(lParam) == VK_F4){
        state_ = repeate;
        endPos = MCIWndGetPosition(playerWnd);
        MCIWndPlayFromTo(playerWnd, startPos, endPos);
        _stprintf(buffer, TEXT("EndPos = %d \n"), endPos);
        OutputDebugString(buffer);
    }
    if(HIWORD(lParam) == VK_F2){
        startPos = endPos;
        endPos = 0;
        state_ = play;
        MCIWndPlayFrom(playerWnd, startPos);
    }
    if(HIWORD(lParam) == VK_F5){
        MCIWndOpen(playerWnd, fileName, NULL);
        MCIWndPlayFrom(playerWnd, 0);
        state_ = play;
    }
    if(HIWORD(lParam) == VK_F1){
        SendMessage(mainWnd_, WM_DESTROY, 0, 0);
    }
}
*/